.paypal-wizard-content
  = form_for payment_prefs_form, url: common_update_admin_payment_preferences_path, html: { id: "transaction_preferences_form_#{pref_mode}", class: "tx_pref_form" }, method: :put do |form|
    = hidden_field_tag 'payment_preferences_form[mode]', 'transaction_fee'
    = hidden_field_tag 'gateway', pref_mode
    - stripe = pref_mode == 'stripe'
    .row
      .col-12
        %h3.paypal-wizard-step
          = t("admin.payment_preferences.transaction_fee_settings")
    .row
      .col-6
        = form.label :commission_from_seller, t("admin.paypal_accounts.transaction_fee_label"), class: "paypal-horizontal-input-label"
      .col-6
        = form.text_field :commission_from_seller, class: "paypal-preferences-input",
          required: true, number_min: 0, number_max:  stripe ? 99 : 100,
          number_no_decimals: true,
          'data-msg-number_max': stripe ? t("admin.payment_preferences.the_transaction_fee_must_be_lower_than_100") : nil

        %label.paypal-horizontal-input-label-unit
          = "%"
    .row
      .col-6
        = form.label :minimum_transaction_fee, t("admin.paypal_accounts.minimum_transaction_fee_label"), class: "paypal-horizontal-input-label"

      .col-6
        - max_tx_fee = payment_prefs_form.minimum_listing_price.to_f
        - max_tx_fee = max_tx_fee - 0.01 if max_tx_fee > 0.01
        = form.text_field :minimum_transaction_fee, class: "paypal-preferences-input",
          required: true, number_max: max_tx_fee,
          number_min: 0,
          'data-msg-number_max': t("admin.payment_preferences.fee_should_be_less_than_minimum_price")

        %label.paypal-horizontal-input-label-unit.paypal-preferences-currency-label
          = currency
    - if pref_mode == 'stripe'
      - buyer_disabled = paypal_active
      .row
        .col-6
          = form.label :commission_from_buyer, t("admin.payment_preferences.commission_from_buyer_label"), class: "paypal-horizontal-input-label"
        .col-6
          = form.text_field :commission_from_buyer, class: "paypal-preferences-input",
            disabled: buyer_disabled
          %label.paypal-horizontal-input-label-unit
            = "%"
      .row
        .col-6
          = form.label :minimum_buyer_transaction_fee, t("admin.payment_preferences.minimum_buyer_transaction_fee_label"), class: "paypal-horizontal-input-label"
        .col-6
          = form.text_field :minimum_buyer_transaction_fee, class: "paypal-preferences-input",
            disabled: buyer_disabled
          %label.paypal-horizontal-input-label-unit.paypal-preferences-currency-label
            = currency
    .row
      .col-12
        = form.button t("admin.payment_preferences.transaction_fee_save")

    - if pref_mode == 'stripe'
      - stripe_fee_link = link_to t("admin.payment_preferences.stripe_fee"), "#{knowledge_base_url}/what-are-stripes-payment-processing-fees" , target: "_blank"
      .row
        .col-12
          %p
            = t("admin.payment_preferences.stripe_fee_notice", stripe_fee_link: stripe_fee_link).html_safe
